package com.zjitc.chapter05.mapper;

import com.zjitc.chapter05.domain.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
    @Select("select * from user where id = #{id}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "orders", column = "id", many = @Many(select = "com.zjitc.chapter05.mapper.OrderMapper.selectOrderListByUserId"))
    })
    User selectUserById(Integer id);
}
